package demo.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Created by Administrator on 2017/12/7 0007.
 */
public class HiveJDBCDemo {
    public static void main(String[] args) {
        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;

        String sql = "select * from t4";

        try{
            conn = JDBCUtil.getConnection();
            st = conn.createStatement();
            rs = st.executeQuery(sql);

            while (rs.next()){
                String tname = rs.getString(2);
                int age = rs.getInt(3);
                System.out.println(String.format("tname=%s, age=%d", tname, age));
            }
        }catch (Exception e){

        }
    }
}
